/*
 * @Description:批次管理操作
 * @Author: Rfan
 * @Date: 2022-06-21 21:37:30
 * @LastEditTime: 2022-06-23 18:20:55
 */

import { useMemo, useState } from 'react';
import { Button, Divider, Space } from 'antd';
import cs from 'classnames';
import { useBoxMgtContext } from '../../contexts/BoxMgtContext';
import AddBoxDialog from '../dialogs/AddBox';

const BoxTableOperate = (props: any) => {
  const { classname } = props;
  const { selectItems, deleteExportFunc } = useBoxMgtContext();

  const [addVisible, setAddVisible] = useState(false);

  return (
    <div className={cs('filter-container', 'page-operate', classname)}>
      <p>盒列表</p>
      <Space size="small">
        <Button
          onClick={() => {
            setAddVisible(true);
          }}
        >
          新建
        </Button>
        <Button
          onClick={() => {
            deleteExportFunc(selectItems, '是否删除选中的导出单');
          }}
        >
          删除
        </Button>
        <Divider type="vertical" />
        <Button>筛选检索</Button>
      </Space>
      {useMemo(
        () => (
          <AddBoxDialog visible={addVisible} onClose={() => setAddVisible(false)} />
        ),
        [addVisible]
      )}
    </div>
  );
};

export default BoxTableOperate;
